package com.jingwu.example.service

import spock.lang.Specification
import spock.lang.Title

/**
 * @author 菁芜
 * @since 2021/11/20
 */
@Title("Spock Test Example")
class FooServiceTest extends Specification {

    def "demo test"() {
        when:
        def a = 1 + 1
        then:
        a == 2

    }

    def "add test"() {
        expect: "aa"
        ++i == result

        where:
        i | result
        1 | 2
        3 | 4
//        3 | 5

    }

    def "logic test"() {
        given:
        def i = 1
        def j = 10

        and:
        j = 2

        when:
        i = i + 2   // i: 3
        j = i + j   // j: 5

        then:
        i == 3
        j == 5

        and:
        i + 1 == 4

        expect:
        i == 3
        j == 5

    }

}
